<%@ include file="/common/taglibs.jsp"%>

<head>
  <title><fmt:message key="attachmentList.title"/></title>
  <meta name="menu" content="AttachmentMenu"/>

  <link rel="stylesheet" type="text/css" media="all" href="<c:url value='/styles/theme.css'/>" />
  <link rel="stylesheet" type="text/css" media="all" href="<c:url value='/styles/jquery-ui.css'/>" />
  <link rel="stylesheet" type="text/css" media="all" href="<c:url value='/styles/galleria.css'/>" />
  <link rel="stylesheet" href="//blueimp.github.io/Gallery/css/blueimp-gallery.min.css">
  <!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
  <link rel="stylesheet" href="<c:url value="/scripts/file-upload/css/jquery.fileupload.css"/>">
  <link rel="stylesheet" href="<c:url value="/scripts/file-upload/css/jquery.fileupload-ui.css"/>">
  <!-- CSS adjustments for browsers with JavaScript disabled -->
  <noscript><link rel="stylesheet" href="<c:url value="/scripts/file-upload/css/jquery.fileupload-noscript.css"/>"></noscript>
  <noscript><link rel="stylesheet" href="<c:url value="/scripts/file-upload/css/jquery.fileupload-ui-noscript.css"/>"></noscript>
  <style type="text/css">
    img{border:none;}
    ul,li{
      margin:0;
      padding:0;
    }

    #imglist img{width:800px;height:500px;}
    #imgshow{
      position:absolute;
      border:1px solid #ccc;
      background:#333;
      padding:5px;
      color:#fff;
      display:none;
    }
  </style>

</head>

<c:if test="{'$'}{not empty searchError}">
  <div class="alert alert-danger alert-dismissable">
    <a href="#" data-dismiss="alert" class="close">&times;</a>
    <c:out value="{'$'}{searchError}"/>
  </div>
</c:if>
<!-- Content Header (Page header) -->
<section class="content-header">
  <h1>
    <fmt:message key="attachmentList.attachment"/>

  </h1>
</section>
<!-- Main content -->
<section class="content">
  <div class="row">
    <div class="col-md-6">

        <spring:bind path="fileUpload.*">
          <c:if test="${not empty status.errorMessages}">
            <div class="alert alert-danger alert-dismissable">
              <a href="#" data-dismiss="alert" class="close">&times;</a>
              <c:forEach var="error" items="${status.errorMessages}">
                <c:out value="${error}" escapeXml="false"/><br />
              </c:forEach>
            </div>
          </c:if>
        </spring:bind>

        <form:form commandName="fileUpload" method="post" action="uploadCaFile" enctype="multipart/form-data"
                   onsubmit="return validateFileUpload(this)" id="uploadForm" cssClass="well">
          <input type="hidden" name="reqId" value="<c:out value="${loanRequest.id}"/>"/>
          <security:authorize ifAnyGranted="ROLE_CA">
            <spring:bind path="fileUpload.name">
              <div class="form-group${(not empty status.errorMessage) ? ' has-error' : ''}">
            </spring:bind>
            <appfuse:label key="uploadForm.name" styleClass="control-label"/>
            <form:input cssClass="form-control" path="name" id="name"/>
            <form:errors path="name" cssClass="help-block"/>
            </div>
            <div class="form-group">
              <appfuse:label key="uploadForm.type" styleClass="control-label"/>
              <select class="form-control" id="type" name="type">
                  <option value="${pageContext.request.getParameter("type")}"><fmt:message key="${pageContext.request.getParameter('type')}"/></option>
              </select>
            </div>
          </security:authorize>
          <spring:bind path="fileUpload.file">
            <div class="form-group${(not empty status.errorMessage) ? ' has-error' : ''}">
          </spring:bind>
          <appfuse:label key="uploadForm.file" styleClass="control-label"/>
          <input type="file" name="file" id="file"/>(<10M)
          <form:errors path="file" cssClass="help-block"/>
          </div>
          <div class="form-group">
            <button type="submit" name="upload" class="btn btn-primary" onclick="bCancel=false">
              <i class="icon-upload icon-white"></i> <fmt:message key="button.upload"/>
            </button>
          </div>
        </form:form>

      <br/>
      <a href='<c:url value="/loanRequestform?reqId=${loanRequest.id}"/>' class="btn btn-primary">
        <fmt:message key="button.back"/></a>
    </div>

  </div>


</section>
<c:set var="scripts" scope="request">
  <v:javascript formName="fileUpload" staticJavascript="false"/>
  <script type="text/javascript" src="<c:url value="/scripts/validator.jsp"/>"></script>
  <%--<script type="text/javascript" src="<c:url value="/scripts/jquery-ui.js"/>"></script>--%>
  <%--<script type="text/javascript" src="<c:url value="/scripts/galleria.js"/>"></script>--%>


</c:set>



